<template>
    <div></div>
</template>
<script lang="ts" setup>
import { useMessage } from 'naive-ui'
import { EventsOn,EventsOff } from '../../wailsjs/runtime/runtime'
import { onMounted,onBeforeUnmount,defineComponent } from 'vue';
import type { LogEventMsg } from '@/scripts/types'

const message = useMessage()

onBeforeUnmount(() => {
  EventsOff('logevent')
})

onMounted(() => {
  EventsOn('logevent', (data: LogEventMsg) => {
    switch (data.Msgtype) {
      case 'info':
        message.info(data.Msg)
        break;
      case 'success':
        message.success(data.Msg)
        break;
      case 'warning':
        message.warning(data.Msg)
        break;
      case 'error':
        message.error(data.Msg)
        break;
      default:
        message.info(data.Msg)
        break;
    }
  })
})
</script>